new function (which I then decided not to use but I think it's needed to
authorHavoc Pennington <hp@redhat.com>
Thu, 17 Jan 2002 22:38:18 +0000 (22:38 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Thu, 17 Jan 2002 22:38:18 +0000 (22:38 +0000)
2002-01-17  Havoc Pennington  <hp@redhat.com>
* gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
function (which I then decided not to use but I think it's needed
to fix #68963
* gtk/gtktextview.c: add page_horizontally action signal and
implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
#53934
* gtk/gtkmarshalers.list: add NONE:INT,BOOL

17 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/gtk/tmpl/gtk-unused.sgml
docs/reference/gtk/tmpl/gtkmenu.sgml
docs/reference/gtk/tmpl/gtknotebook.sgml
docs/reference/gtk/tmpl/gtkpaned.sgml
docs/reference/gtk/tmpl/gtktextview.sgml
gtk/gtkmarshalers.list
gtk/gtktextlayout.c
gtk/gtktextlayout.h
gtk/gtktextview.c
gtk/gtktextview.h

index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 1e10abcd7ca864f22b68ea7aae1f6807bb5c7505..b301f95861da6f5061cc4fa972c9108cfb8c194e 100644 (file)
@@ -1,3 +1,16 @@
+2002-01-17  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+       function (which I then decided not to use but I think it's needed
+       to fix #68963
+
+       * gtk/gtktextview.c: add page_horizontally action signal and
+       implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, 
+       hackily modified to avoid adding GTK_MOVEMENT_ API. Part of 
+       #53934
+
+       * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
 Thu Jan 17 17:02:38 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
index 456bfeb3dd353c1fdcfcf395ed25471f456a531e..a3bb8b493ed9cfbd908df043ccbca0c233eb8c6e 100644 (file)
@@ -2550,12 +2550,6 @@ Internal function used by #GtkHPaned and #GtkVPaned
 @child1_req: 
 @child2_req: 
 
-<!-- ##### MACRO gtk_paned_handle_size ##### -->
-<para>
-Old name for gtk_paned_set_handle_size().
-</para>
-
-
 <!-- ##### FUNCTION gtk_paned_set_handle_size ##### -->
 <para>
 Set the the handle size to @size x @size pixels.
index c060e31b9236b8010becde9b8f67316c0904267f..f0db72f47a75e82605cf84240e3dc3e89498f95a 100644 (file)
@@ -96,9 +96,9 @@ Creates a new #GtkMenu.
 Adds a new #GtkMenuItem to the end of the menu's item list.
 </para>
 
+<!-- # Unused Parameters # -->
 @menu: a #GtkMenu.
 @child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
 @m: 
 @c: 
 
@@ -108,9 +108,9 @@ Adds a new #GtkMenuItem to the end of the menu's item list.
 Adds a new #GtkMenuItem to the beginning of the menu's item list.
 </para>
 
+<!-- # Unused Parameters # -->
 @menu: a #GtkMenu.
 @child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
 @menu_child: 
 @m: 
 @c: 
@@ -122,10 +122,10 @@ Adds a new #GtkMenuItem to the menu's item list at the position
 indicated by @position. 
 </para>
 
+<!-- # Unused Parameters # -->
 @menu: a #GtkMenu.
 @child: The #GtkMenuItem to add.
 @pos: 
-<!-- # Unused Parameters # -->
 @position: The position in the item list where @child is added.
 Positions are numbered from 0 to n-1.
 
index c4f727b78298a538732b987a2f41c4d2ac34531d..96c321bbcb409dd5522f884fcb94abc6cc46e775 100644 (file)
@@ -407,6 +407,7 @@ gtk_notebook_set_current_page() instead.
 
 @notebook: the object which received the signal.
 @arg1: 
+@Returns: 
 
 <!-- ##### SIGNAL GtkNotebook::focus-tab ##### -->
 <para>
@@ -423,6 +424,7 @@ gtk_notebook_set_current_page() instead.
 
 @notebook: the object which received the signal.
 @arg1: 
+@Returns: 
 
 <!-- ##### SIGNAL GtkNotebook::switch-page ##### -->
 <para>
index 1e3b1df6b8c8ec0c96089ab436ac6c3f711913c9..33f24283a36fe8945384778d815aef8365098b32 100644 (file)
@@ -95,6 +95,13 @@ parameters. This is equivalent to
 @child: the child to add
 
 
+<!-- ##### MACRO gtk_paned_handle_size ##### -->
+<para>
+Old name for gtk_paned_set_handle_size().
+</para>
+
+
+
 <!-- ##### MACRO gtk_paned_gutter_size ##### -->
 <para>
 Old name for gtk_paned_set_gutter_size().
index 51ab152f35d80217b5b39516eabdb4b1307cec73..6e6617c87c96b55124ea190bfced448e221fd673 100644 (file)
@@ -648,6 +648,15 @@ in an idle job in the background.
 @textview: the object which received the signal.
 @arg1: 
 
+<!-- ##### SIGNAL GtkTextView::page-horizontally ##### -->
+<para>
+
+</para>
+
+@textview: the object which received the signal.
+@arg1: 
+@arg2: 
+
 <!-- ##### SIGNAL GtkTextView::paste-clipboard ##### -->
 <para>
 
index 659b626f3b10e732d1faff621b41d862232e96cb..d1e9159590d36bf44e3aac0afd7d53b9e5b63774 100644 (file)
@@ -36,6 +36,7 @@ INT:POINTER
 NONE:BOOLEAN
 NONE:ENUM
 NONE:INT
+NONE:INT,BOOL
 NONE:INT,INT
 NONE:NONE
 NONE:STRING,INT,POINTER
index 4a85903a6b09c8ebaf8c65fe77e68830a8473f91..d6bfbd087791570748be70bc94617293957729f7 100644 (file)
@@ -2249,6 +2249,45 @@ gtk_text_layout_get_line_yrange (GtkTextLayout     *layout,
     }
 }
 
+/**
+ * _gtk_text_layout_get_line_xrange:
+ * @layout: a #GtkTextLayout
+ * @iter:   a #GtkTextIter
+ * @x:      location to store the top of the paragraph in pixels,
+ *          or %NULL.
+ * @width  location to store the height of the paragraph in pixels,
+ *          or %NULL.
+ *
+ * Find the range of X coordinates for the paragraph containing
+ * the given iter. Private for 2.0 due to API freeze, could
+ * be made public for 2.2.
+ **/
+void
+_gtk_text_layout_get_line_xrange (GtkTextLayout     *layout,
+                                  const GtkTextIter *iter,
+                                  gint              *x,
+                                  gint              *width)
+{
+  GtkTextLine *line;
+
+  g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
+  g_return_if_fail (_gtk_text_iter_get_btree (iter) == _gtk_text_buffer_get_btree (layout->buffer));
+
+  line = _gtk_text_iter_get_text_line (iter);
+
+  if (x)
+    *x = 0; /* FIXME This is wrong; should represent the first available cursor position */
+  
+  if (width)
+    {
+      GtkTextLineData *line_data = _gtk_text_line_get_data (line, layout);
+      if (line_data)
+        *width = line_data->width;
+      else
+        *width = 0;
+    }
+}
+
 void
 gtk_text_layout_get_iter_location (GtkTextLayout     *layout,
                                    const GtkTextIter *iter,
index 5e52f7d32b3b3178d657f450f8ac1b38e37611a0..9418b974d2ff4a4e38461de2bb065fe5ceda4b25 100644 (file)
@@ -345,6 +345,10 @@ void     gtk_text_layout_get_line_yrange      (GtkTextLayout     *layout,
                                                const GtkTextIter *iter,
                                                gint              *y,
                                                gint              *height);
+void     _gtk_text_layout_get_line_xrange     (GtkTextLayout     *layout,
+                                               const GtkTextIter *iter,
+                                               gint              *x,
+                                               gint              *width);
 void     gtk_text_layout_get_cursor_locations (GtkTextLayout     *layout,
                                                GtkTextIter       *iter,
                                                GdkRectangle      *strong_pos,
index e862ac9d030d920ad43575f8f6a4b82e47162e35..7f3f79e3b179460828b3cbcd008c7407b848678f 100644 (file)
@@ -109,6 +109,7 @@ enum
   SET_SCROLL_ADJUSTMENTS,
   POPULATE_POPUP,
   MOVE_CURSOR,
+  PAGE_HORIZONTALLY,
   SET_ANCHOR,
   INSERT_AT_CURSOR,
   DELETE_FROM_CURSOR,
@@ -223,13 +224,18 @@ static void gtk_text_view_set_scroll_adjustments (GtkTextView   *text_view,
                                                   GtkAdjustment *vadj);
 static void gtk_text_view_popup_menu             (GtkWidget     *widget);
 
-static void gtk_text_view_move_cursor      (GtkTextView           *text_view,
-                                            GtkMovementStep        step,
-                                            gint                   count,
-                                            gboolean               extend_selection);
+static void gtk_text_view_move_cursor       (GtkTextView           *text_view,
+                                             GtkMovementStep        step,
+                                             gint                   count,
+                                             gboolean               extend_selection);
+static void gtk_text_view_page_horizontally (GtkTextView          *text_view,
+                                             gint                  count,
+                                             gboolean              extend_selection);
 static void gtk_text_view_set_anchor       (GtkTextView           *text_view);
 static void gtk_text_view_scroll_pages     (GtkTextView           *text_view,
                                             gint                   count);
+static void gtk_text_view_scroll_hpages    (GtkTextView           *text_view,
+                                            gint                   count);
 static void gtk_text_view_insert_at_cursor (GtkTextView           *text_view,
                                             const gchar           *str);
 static void gtk_text_view_delete_from_cursor (GtkTextView           *text_view,
@@ -508,6 +514,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
   container_class->forall = gtk_text_view_forall;
 
   klass->move_cursor = gtk_text_view_move_cursor;
+  klass->page_horizontally = gtk_text_view_page_horizontally;
   klass->set_anchor = gtk_text_view_set_anchor;
   klass->insert_at_cursor = gtk_text_view_insert_at_cursor;
   klass->delete_from_cursor = gtk_text_view_delete_from_cursor;
@@ -649,6 +656,14 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
                     _gtk_marshal_VOID__ENUM_INT_BOOLEAN,
                     GTK_TYPE_NONE, 3, GTK_TYPE_MOVEMENT_STEP, GTK_TYPE_INT, GTK_TYPE_BOOL);
 
+  signals[PAGE_HORIZONTALLY] =
+    gtk_signal_new ("page_horizontally",
+                    GTK_RUN_LAST | GTK_RUN_ACTION,
+                    GTK_CLASS_TYPE (object_class),
+                    GTK_SIGNAL_OFFSET (GtkTextViewClass, page_horizontally),
+                    _gtk_marshal_VOID__INT_BOOLEAN,
+                    GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_BOOL);
+  
   signals[SET_ANCHOR] =
     gtk_signal_new ("set_anchor",
                     GTK_RUN_LAST | GTK_RUN_ACTION,
@@ -735,7 +750,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
    */
 
   binding_set = gtk_binding_set_by_class (klass);
-
+  
   /* Moving the insertion point */
   add_move_binding (binding_set, GDK_Right, 0,
                     GTK_MOVEMENT_VISUAL_POSITIONS, 1);
@@ -845,6 +860,46 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
 
   add_move_binding (binding_set, GDK_KP_Page_Down, 0,
                     GTK_MOVEMENT_PAGES, 1);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, GDK_CONTROL_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, -1,
+                                GTK_TYPE_BOOL, FALSE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, -1,
+                                GTK_TYPE_BOOL, TRUE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, -1,
+                                GTK_TYPE_BOOL, FALSE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, -1,
+                                GTK_TYPE_BOOL, TRUE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, GDK_CONTROL_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, 1,
+                                GTK_TYPE_BOOL, FALSE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, 1,
+                                GTK_TYPE_BOOL, TRUE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, 1,
+                                GTK_TYPE_BOOL, FALSE);
+
+  gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+                                "page_horizontally", 2,
+                                GTK_TYPE_INT, 1,
+                                GTK_TYPE_BOOL, TRUE);
   
   /* Setting the cut/paste/copy anchor */
   gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK,
@@ -4329,11 +4384,16 @@ gtk_text_view_move_iter_by_lines (GtkTextView *text_view,
     }
 }
 
+/* FIXME when we are unfrozen and can change GtkMovementStep,
+ * fix this
+ */
+#define PAGE_HORIZONTALLY_HACK_VALUE 57
+
 static void
-gtk_text_view_move_cursor (GtkTextView     *text_view,
-                           GtkMovementStep  step,
-                           gint             count,
-                           gboolean         extend_selection)
+gtk_text_view_move_cursor_internal (GtkTextView     *text_view,
+                                    GtkMovementStep  step,
+                                    gint             count,
+                                    gboolean         extend_selection)
 {
   GtkTextIter insert;
   GtkTextIter newplace;
@@ -4348,6 +4408,12 @@ gtk_text_view_move_cursor (GtkTextView     *text_view,
       gtk_text_view_pend_cursor_blink (text_view);
       return;
     }
+  else if (step == PAGE_HORIZONTALLY_HACK_VALUE)
+    {
+      gtk_text_view_scroll_hpages (text_view, count);
+      gtk_text_view_pend_cursor_blink (text_view);
+      return;
+    }
 
   gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
                                     gtk_text_buffer_get_mark (get_buffer (text_view),
@@ -4413,7 +4479,7 @@ gtk_text_view_move_cursor (GtkTextView     *text_view,
       else if (count < 0)
         gtk_text_buffer_get_iter_at_offset (get_buffer (text_view), &newplace, 0);
       break;
-
+      
     default:
       break;
     }
@@ -4442,6 +4508,24 @@ gtk_text_view_move_cursor (GtkTextView     *text_view,
   gtk_text_view_pend_cursor_blink (text_view);
 }
 
+static void
+gtk_text_view_move_cursor (GtkTextView     *text_view,
+                           GtkMovementStep  step,
+                           gint             count,
+                           gboolean         extend_selection)
+{
+  gtk_text_view_move_cursor_internal (text_view, step, count, extend_selection);
+}
+
+static void
+gtk_text_view_page_horizontally (GtkTextView     *text_view,
+                                 gint             count,
+                                 gboolean         extend_selection)
+{
+  gtk_text_view_move_cursor_internal (text_view, PAGE_HORIZONTALLY_HACK_VALUE,
+                                      count, extend_selection);
+}
+
 static void
 gtk_text_view_set_anchor (GtkTextView *text_view)
 {
@@ -4528,6 +4612,77 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
                                                                 "insert"));
 }
 
+static void
+gtk_text_view_scroll_hpages (GtkTextView *text_view,
+                             gint         count)
+{
+  gdouble newval;
+  gdouble oldval;
+  GtkAdjustment *adj;
+  gint cursor_x_pos, cursor_y_pos;
+  GtkTextIter new_insert;
+  gint y, height;
+  gint x, width;
+  
+  g_return_if_fail (text_view->hadjustment != NULL);
+
+  adj = text_view->hadjustment;
+
+  /* Validate the line that we're moving within.
+   */
+  gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
+                                    &new_insert,
+                                    gtk_text_buffer_get_mark (get_buffer (text_view), "insert"));
+  gtk_text_layout_get_line_yrange (text_view->layout, &new_insert, &y, &height);
+  gtk_text_layout_validate_yrange (text_view->layout, &new_insert, y, y + height);
+  /* FIXME do we need to update the adjustment ranges here? */
+  
+  if (count < 0 && adj->value <= (adj->lower + 1e-12))
+    {
+      /* already at far left, just be sure we are at offset 0 */
+      gtk_text_iter_set_line_offset (&new_insert, 0);
+      gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+    }
+  else if (count > 0 && adj->value >= (adj->upper - adj->page_size - 1e-12))
+    {
+      /* already at far right, just be sure we are at the end */
+      gtk_text_iter_forward_to_line_end (&new_insert);
+      gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+    }
+  else
+    {
+      gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
+
+      newval = adj->value;
+      oldval = adj->value;
+  
+      newval += count * adj->page_increment;
+
+      set_adjustment_clamped (adj, newval);
+      cursor_x_pos += adj->value - oldval;
+
+      gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
+      clamp_iter_onscreen (text_view, &new_insert);
+      gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+
+      gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
+    }
+
+  /*  FIXME for lines shorter than the overall widget width, this results in a
+   *  "bounce" effect as we scroll to the right of the widget, then scroll
+   *  back to get the end of the line onscreen.
+   *      http://bugzilla.gnome.org/show_bug.cgi?id=68963
+   */
+  
+  /* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
+   * only guarantees 1 pixel onscreen.
+   */
+  DV(g_print (G_STRLOC": scrolling onscreen\n"));
+  gtk_text_view_scroll_mark_onscreen (text_view,
+                                      gtk_text_buffer_get_mark (get_buffer (text_view),
+                                                                "insert"));
+}
+
 static gboolean
 whitespace (gunichar ch, gpointer user_data)
 {
index b52ca6d12bd56b3edd3ee5c8ac0546eb155e6466..df8abe7802fab03b845de43463a1a89296d9982d 100644 (file)
@@ -168,6 +168,15 @@ struct _GtkTextViewClass
                         GtkMovementStep step,
                         gint            count,
                         gboolean        extend_selection);
+
+  /* FIXME should be deprecated in favor of adding GTK_MOVEMENT_HORIZONTAL_PAGES
+   * or something in GTK 2.2, was put in to avoid adding enum values during
+   * the freeze.
+   */
+  void (* page_horizontally) (GtkTextView *text_view,
+                              gint         count,
+                              gboolean     extend_selection);
+  
   /* move the "anchor" (what Emacs calls the mark) to the cursor position */
   void (* set_anchor)  (GtkTextView    *text_view);
 
@@ -187,7 +196,8 @@ struct _GtkTextViewClass
 
   /* propagates to GtkWindow move_focus */
   void (* move_focus)       (GtkTextView     *text_view,
-                             GtkDirectionType direction);
+                             GtkDirectionType direction);  
+  
   
   GtkFunction pad1;
   GtkFunction pad2;